package cn.kgc.springboot;

import cn.kgc.springboot.controller.HelloController;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

import javax.lang.model.element.VariableElement;

/**
 * @author: mosin
 * @version: v1.0  2022/11/1
 * springboot工程启动类
 * 类名成： xxxApplication
 * @SpringBootApplication 注解  标识当前类是项目的启动类
 * 复合注解
 * @SpringBootConfiguration    配置类  @Configuration
 * @EnableAutoConfiguration    开启自动配置
 * @ComponentScan              开启包扫描    路径：启动类所在的包及其子包
 *
 */
@SpringBootApplication
public class SpringBoot03Application {

    public static void main(String[] args) {

        // 关闭启动图标
        //SpringApplication springApplication = new SpringApplication(SpringBoot03Application.class);
        //springApplication.setBannerMode(Banner.Mode.OFF);
        //springApplication.run(args);

        ConfigurableApplicationContext run = SpringApplication.run(SpringBoot03Application.class, args);
        // 获取指定名称bean
        HelloController helloController = run.getBean("helloController", HelloController.class);
        System.out.println("helloController = " + helloController);

    }
}
